﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title>Form</title>
    <script type="text/javascript">
    <!--自定义表单前端处理-->
    function element()
    {
       this.css='';
       this.id='';
       this.name='';
       this.nodeName='';
       this.bind=function(event,func){
          
       }
       this.unbind=function(event,func)
       {
         
       }
       this.remove=function(){
          
       }       
    }
    var input=function(){//直接量构造，或者初始化
    if(arguments.length>0)
    {
          var o=arguments[0];
          this.enabled=o.enabled;
          this.necessary=o.necessary;
          this.type=o.type;
          this.text=o.text;
          this.value=o.value;
          this.readOnly=o.readOnly;
          this.checked=o.checked;
          this.rgexp=o.rgexp;
          this.check=o.check;
    }else{
          this.enabled=true;//是否可用
          this.necessary=false;//是否必要
          this.type='';//类型
          this.text='';//文字标签
          this.value='';//值
          this.readOnly='';//是否只读
          this.checked='';//是否选中 对check radio有效
          this.rgexp='';//验证正则
          this.check=function(){//输入验证
             //通过正则与值匹配得出结果
          }    
          }              
      }
      
    var select=function(){//直接量构参
    if(arguments.length>0)
    {
       var obj=arguments[0];
       this.readOnly=obj.readOnly;
       this.value=obj.value;
       this.options=obj.options;
       this.selectIndex=obj.selectIndex;
       this.change=obj.change;
    }else{
       this.readOnly=false;
       this.value='';
       this.options=[];
       this.selectIndex=0;
       this.change=function(){
          
       }
       }  
       
    }    
    var Form={
      input:[],
      select:[],   
      submit:function(func)
      {
         //提交处理--独立出来不做节点相关的bind处理
      },
      action:'',
      method:'',
      reset:function(){
         //重置触发处理
      },
      render:function(){
        //表单输出
      }
    }
    Form.constructor.prototype=new element();//继承下element
    select.prototype=new element();//继承下element
    input.prototype=new element();//继承下element
    </script>
</head>
<body>

</body>
</html>
